#ifndef KEY_H
#define KEY_H

#include <QWidget>
#include <QVector>
#include <QCloseEvent>

class keyinfo {
public:
    QString name;
    QString publisher;
    int type;
    QByteArray key;
    explicit keyinfo(QString n, QString pub, int typ, QByteArray ke): name(n),publisher(pub),type(typ),key(ke) {}
};

namespace Ui {
class key;
}

class key : public QWidget
{
    Q_OBJECT

public:
    explicit key(QVector<class keyinfo> &ki, QWidget *parent = nullptr);
    ~key();

private:
    Ui::key *ui;
    QVector<class keyinfo> &kinfo;

    void keyInit();

signals:
    void closed();
    void keyChange();

protected:
    void closeEvent(QCloseEvent *event) override {
        emit closed(); // 发射信号
        event->accept();
    }
private slots:
    void on_selectCB_currentIndexChanged(int index);
    void on_add_clicked();
    void on_delete_2_clicked();
};

#endif // KEY_H
